package com.mybatisx.mybatisplus.controller;

import com.mybatisx.mybatisplus.entity.SysUser;
import com.mybatisx.mybatisplus.service.UserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author zhang.fuqing
 * @date 2021-04-16 20:59:14
 */
@Api(tags = "用户控制器")
@RestController
public class SysUserController {

    @Resource
     private UserService userService;

    @ApiOperation(value="获取所有用户信息", notes="获取所有用户信息列表")
    @GetMapping(value="/api/user")
    public List<SysUser> findAll() {
        return userService.findAll();
    }

    @ApiOperation(value="根据ID获取用户信息", notes="根据用户主键获取用户信息")
   //@ApiImplicitParam(name = "id", value = "用户主键", required = true, dataType = "String")
    @GetMapping(value="/api/user/{id}")
    public SysUser getUser(@PathVariable String id) {
        return userService.findUserById(id);
    }
}

